/* GUI CONVERTED from rsrp08.i (converter v1.76) Thu May 30 23:45:12 2002 */
/* rsrp08.i - Release Management Supplier Schedules                     */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                  */
/* All rights reserved worldwide.  This is an unpublished work.         */
/* $Revision: 1.6.1.5 $                                                */
/*V8:ConvertMode=Report                                                 */
/* REVISION: 7.3    LAST MODIFIED: 10/06/92    BY: WUG *G462*           */
/* REVISION: 7.3    LAST MODIFIED: 07/14/93    BY: WUG *GD42*           */
/* REVISION: 7.3    LAST MODIFIED: 09/27/93    BY: WUG *GF96*           */
/* REVISION: 7.3    LAST MODIFIED: 10/04/93    BY: WUG *GG16*           */
/* REVISION: 8.6    LAST MODIFIED: 10/21/97    BY: bvm *K140*           */
/* REVISION: 8.6    LAST MODIFIED: 11/17/97    BY: *J268* Niranjan R.   */
/* REVISION: 8.6E   LAST MODIFIED: 02/23/98   BY: *L007* A. Rahane      */
/* REVISION: 8.6E   LAST MODIFIED: 10/04/98   BY: *J314* Alfred Tan     */
/* REVISION: 9.1    LAST MODIFIED: 03/24/00 BY: *N08T* Annasaheb Rahane */
/* REVISION: 9.1    LAST MODIFIED: 08/12/00 BY: *N0KP* myb              */
/* REVISION: 9.1    LAST MODIFIED: 09/11/00 BY: *N0RT* Mudit Mehta      */
/* Old ECO marker removed, but no ECO header exists *F0PN*                    */
/* Revision: 1.6.1.4      BY: Patrick Rowan    DATE: 05/24/02  ECO: *P018*  */
/* $Revision: 1.6.1.5 $           BY: Lena Lim         DATE: 05/31/02  ECO: *P07G*  */
/******************************************************************************/
/* All patch markers and commented out code have been removed from the source */
/* code below. For all future modifications to this file, any code which is   */
/* no longer required should be deleted and no in-line patch markers should   */
/* be added.  The ECO marker should only be included in the Revision History. */
/******************************************************************************/
/* SHIPPING SUMMARY REPORT INCLUDE */

/*
 * {1} = first part of "for each"
 * {2} = break by
 *{3} = lowest break by field above tr_trnbr
*/


/*GUI preprocessor directive settings */
&SCOPED-DEFINE PP_GUI_CONVERT_MODE REPORT

{mfdeclre.i}
{gplabel.i} /* EXTERNAL LABEL INCLUDE */

/* ********** Begin Translatable Strings Definitions ********* */

&SCOPED-DEFINE rsrp08_i_2 "Ship-To Site"
/* MaxLen: Comment: */

&SCOPED-DEFINE rsrp08_i_3 "Report Cum Adjs/Resets"
/* MaxLen: Comment: */

&SCOPED-DEFINE rsrp08_i_4 "Site!Location"
/* MaxLen: Comment: */

&SCOPED-DEFINE rsrp08_i_5 "Report Shipments"
/* MaxLen: Comment: */

&SCOPED-DEFINE rsrp08_i_6 "Report Returns"
/* MaxLen: Comment: */

&SCOPED-DEFINE rsrp08_i_7 "Receiver!Packing Slip"
/* MaxLen: Comment: */

&SCOPED-DEFINE rsrp08_i_8 "Receipt Qty"
/* MaxLen: Comment: */

&SCOPED-DEFINE rsrp08_i_10 "Type!User ID"
/* MaxLen: Comment: */

&SCOPED-DEFINE rsrp08_i_11 "Time"
/* MaxLen: Comment: */

&SCOPED-DEFINE rsrp08_i_12 "Adj Qty"
/* MaxLen: Comment: */

&SCOPED-DEFINE rsrp08_i_13 "Lot/Serial!Reference"
/* MaxLen: Comment: */

&SCOPED-DEFINE rsrp08_i_16 "Created"
/* MaxLen: Comment: */

/* ********** End Translatable Strings Definitions ********* */

{wbrp02.i}

define shared variable supplier_from like po_vend.
define shared variable supplier_to like po_vend.
define shared variable shipto_from like po_ship.
define shared variable shipto_to like po_ship.
define shared variable part_from like pod_part.
define shared variable part_to like pod_part.
define shared variable po_from like po_nbr.
define shared variable po_to like po_nbr.
define shared variable buyer_from like po_buyer.
define shared variable buyer_to like po_buyer.
define shared variable date_from as date label {&rsrp08_i_16}.
define shared variable date_to as date.
define shared variable rct_trans like mfc_logical label {&rsrp08_i_5}.
define shared variable rtn_trans like mfc_logical label {&rsrp08_i_6}.
define shared variable cum_trans like mfc_logical label {&rsrp08_i_3}.
define variable last_rcvr as character initial ?.
define variable disp_time as character format "x(5)" label {&rsrp08_i_11}.

/* CONSIGNMENT VARIABLES */
define variable skip_rct_po as logical no-undo.
define variable consignment_order as character format "x(20)" no-undo.
{pocnvars.i}
define temp-table tt_skip_table no-undo
   field tt_order    as character
   field tt_line     as integer
   index tt_order_line is unique
   tt_order
   tt_line.

FORM /*GUI*/  with STREAM-IO /*GUI*/  frame heading
   width 132.  /* SCOPE TO PROGRAM */

FORM /*GUI*/ 
   tr_date
   disp_time
   tr_trnbr
   tr_type        format "x(9)" column-label {&rsrp08_i_10}
   tr_site        column-label {&rsrp08_i_4}
   tr_serial      column-label {&rsrp08_i_13} format "x(24)"
   tr_qty_loc     column-label {&rsrp08_i_8}
   tr_um
   space(2)
   idh_qty_inv    column-label {&rsrp08_i_12}
   prh_cum_rcvd
   pod_um
   prh_ps_nbr     format "x(12)" column-label {&rsrp08_i_7}
with STREAM-IO /*GUI*/  frame detail down width 132 no-box.

/* SET EXTERNAL LABELS */
setFrameLabels(frame detail:handle).

/* DETERMINE IF SUPPLIER CONSIGNMENT IS ACTIVE */
{gprun.i ""gpmfc01.p""
   "(input ENABLE_SUPPLIER_CONSIGNMENT,
     input 11,
     input ADG,
     input SUPPLIER_CONSIGN_CTRL_TABLE,
     output using_supplier_consignment)"}

{1}
each tr_hist no-lock
   where tr_nbr = po_nbr
   and tr_line = pod_line
   and tr_part = pod_part
   and
   (tr_type = "RCT-PO"
   or
   tr_type = "CUM-RADJ"
   or
   tr_type = "CUM-RRES"
   or
   tr_type = "ISS-PRV"
   or
   tr_type = "CN-RCT"
   )
   and (tr_date >= date_from or date_from = ?)
   and (tr_date <= date_to or date_to = ?)
   and (rct_trans and tr_type = "RCT-PO"
   or  rct_trans and tr_type = "CN-RCT"
   or rtn_trans and tr_type = "ISS-PRV"
   or cum_trans and tr_type begins "CUM")
   use-index tr_nbr_eff
   {2}:

if first-of({3}) then do:

   find ad_mstr where ad_addr = po_vend no-lock.
   find pt_mstr where pt_part = pod_part no-lock.

   /* FOR SUPPLIER CONSIGNMENT, THE RCT-PO TRANSACTIONS ARE     */
   /* TO BE SKIPPED SINCE THE CN-RCT TRANS REPRESENT THE ACTUAL */
   /* RECEIPT OF MATERIAL.  A NEW TEMP-TABLE IS USED TO KEEP    */
   /* TRACK OF CONSIGNED ORDER/LINES AND REDUCE THE AMOUNT OF   */
   /* CALLS NEEDED TO CHECK IF A PO/LINE IS CONSIGNED.          */

   if using_supplier_consignment
      and consign_flag then do:

      /* CREATE ENTRY IN ORDER/LINE "SKIP" TABLE */
      create tt_skip_table.
      assign
         tt_order = tr_nbr
         tt_line  = tr_line.

      if recid(tt_skip_table) = -1 then .

   end. /* if using_supplier_consignment */

   consignment_order = (if consign_flag then
   getTermLabel("CONSIGNED_CONTRACT",20)
   else "").

   /* SET EXTERNAL LABELS */
   setFrameLabels(frame heading:handle).
   display
      skip(1)
      pod_nbr       colon 15
      po_vend       colon 15
      ad_name       no-label
      pod_site      colon 15 label {&rsrp08_i_2}
      po_buyer      colon 15
      pod_part      colon 15
      pt_desc1      no-label
      pod_line      colon 15
      consignment_order colon 27 no-label
   with frame heading page-top width 132 no-box side-labels STREAM-IO /*GUI*/ .

end.

if tr_type = "RCT-PO"
   or tr_type = "ISS-PRV"
   or tr_type = "CN-RCT"
then do:

   /* CHECK TO SEE IF ORDER/LINE IS IN "SKIP" TABLE */
   if using_supplier_consignment and
      rct_trans and tr_type = "RCT-PO" and
      can-find (first tt_skip_table where
      tt_order = tr_nbr and
      tt_line  = tr_line)
   then do:

      if last-of({3}) then do:
         hide frame heading.
         page.
      end.
      next.
   end.  /* if using_supplier_consignment */

   display
      tr_date
      string(tr_time,"HH:MM") @ disp_time
      tr_trnbr
      getTermLabel("RECEIPT",9) when (tr_type = "CN-RCT")  @ tr_type
      getTermLabel("RECEIPT",9) when (tr_type = "RCT-PO")  @ tr_type
      getTermLabel("RETURN",9)  when (tr_type = "ISS-PRV") @ tr_type
      tr_site
      tr_serial
      tr_qty_loc @ tr_qty_loc
      tr_um
      pod_um
   with frame detail STREAM-IO /*GUI*/ .

   find prh_hist where prh_receiver = tr_lot and prh_line = pod_line
      use-index prh_receiver no-lock no-error.

   if available prh_hist then do:

      display
         prh_cum_rcvd
         prh_receiver @ prh_ps_nbr
      with frame detail STREAM-IO /*GUI*/ .
   end.

   down 1 with frame detail.

   display
      tr_userid @ tr_type
      tr_loc @ tr_site
      tr_ref @ tr_serial
   with frame detail STREAM-IO /*GUI*/ .

   find prh_hist where prh_receiver = tr_lot
      and prh_line = pod_line
      use-index prh_receiver no-lock no-error.

   if available prh_hist then do:

      display
         prh_ps_nbr
      with frame detail STREAM-IO /*GUI*/ .
   end.

end.
else
   if tr_type = "CUM-RADJ" then do:

   display
      tr_date
      string(tr_time,"HH:MM") @ disp_time
      tr_trnbr
      getTermLabel("CUM_ADJ",9) @ tr_type
      tr_rmks @ tr_serial
      tr_qty_chg @ idh_qty_inv
      tr_loc_begin @ prh_cum_rcvd
      pod_um
   with frame detail STREAM-IO /*GUI*/ .

   down 1 with frame detail.

   display tr_userid @ tr_type with frame detail STREAM-IO /*GUI*/ .

end.
else
   if tr_type = "CUM-RRES" then do:

   display
      tr_date
      string(tr_time,"HH:MM") @ disp_time
      tr_trnbr
      getTermLabel("CUM_RESET",9) @ tr_type
      tr_rmks @ tr_serial
      tr_qty_chg @ idh_qty_inv
      tr_loc_begin @ prh_cum_rcvd
      pod_um
   with frame detail STREAM-IO /*GUI*/ .

   down 1 with frame detail.

   display tr_userid @ tr_type with frame detail STREAM-IO /*GUI*/ .
end.

down 1 with frame detail.

last_rcvr = tr_lot.


/*GUI*/ {mfguichk.i } /*Replace mfrpchk*/


if last-of({3}) then do:
   hide frame heading.
   page.
end.

end.

{wbrp04.i}
